#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_set>
using namespace std;
string str;
vector<string> ret;
int vis[20];
void dfs(string cur)
{
	if(cur.size()==str.size())
	{
		ret.push_back(cur);
		return;
	}
	unordered_set<char> has;
	for(int i=0;i<str.size();i++)
	{
		if(has.count(str[i]) || vis[i])
			continue;
		vis[i]=1;
		has.insert(str[i]);
		dfs(cur+str[i]);
		vis[i]=0;
	}
}
int main()
{

	
	cin>>str;
	sort(str.begin(),str.end());
	dfs("");
	for(int i=0;i<ret.size();i++)
	{
		cout<<ret[i]<<endl;
	}
	return 0;
}
